#ifndef SCENE_H
#define SCENE_H

#include "EngineApi.h"
#include "Renderer.h"
#include "Importer.h"
#include "Entity.h"
#include "DirectInput.h"
#include "Input.h"

#include <map>

class ENGINE_API Scene
{
public:
   Scene(std::string name) : m_name(name), m_updateable(true), m_drawable(true){}
   ~Scene(){}
   bool init(Renderer* renderer, Importer* pImporter, Input* pInput);
   void update(float deltaTime);
   void draw(Renderer* renderer);

   bool addEntity(Entity* entity);
   void removeEntity(Entity* entity);

   void setName(std::string name) { m_name = name; }
   std::string getName() { return m_name; }

   bool isUpdateable() { return m_updateable; }
   bool isDrawable() { return m_drawable; }

   void setUpdateable(bool updateable) { m_updateable; }
   void setDrawable(bool drawable) { m_drawable; }

   Input* getInput() { return m_pInput; }

   bool addToCollisionGrup( std::string& name, Entity* entity );
   bool removeFromCollisionGroup( std::string& name );

   void checkCollisions();

protected:
   
   virtual bool onInit(Renderer* renderer, Importer* pImporter)=0;
   virtual void onUpdate()=0;
   virtual void onDraw(Renderer* renderer)=0;

private:
   std::map<std::string, Entity*> m_entityMap;
   std::map<std::string, std::vector<Entity*>> m_collisionMap;
   std::string m_name;

   bool m_updateable;
   bool m_drawable;

   Input* m_pInput;
};

#endif//SCENE_H